package com.bw.liuyushan.liuyushan20210904.MVP.Activity;

import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.content.Intent;
import android.widget.ImageView;

import com.blankj.utilcode.util.ToastUtils;
import com.bw.liuyushan.liuyushan20210904.MVP.Contrack.IContrackTest;
import com.bw.liuyushan.liuyushan20210904.MVP.Model.BaseModelTest;
import com.bw.liuyushan.liuyushan20210904.MVP.Presenter.BasePresenterTest;
import com.bw.liuyushan.liuyushan20210904.R;
import com.bw.liuyushan.mvp_lib.VIew.BaseActivity;

public class WelcomeActivity extends BaseActivity<BasePresenterTest> implements IContrackTest.C_ViewTest {


    private android.widget.ImageView welcomego;

    @Override
    public int bindLayout() {
        return R.layout.activity_welconme;
    }

    @Override
    public void initView() {
        //防止内存泄露
        mPresenter=new BasePresenterTest(new BaseModelTest(),this);
        welcomego = (ImageView) findViewById(R.id.welcomego);
    }

    @Override
    public void initDate() {
        //透明属性动画
        ObjectAnimator alpha = ObjectAnimator.ofFloat(welcomego, "alpha", 1, 0);
        alpha.setDuration(5000);//设置时间5秒跳转
        alpha.start();
        alpha.addListener(new Animator.AnimatorListener() {
            @Override
            public void onAnimationStart(Animator animation) {
                ToastUtils.showShort("导航页5秒后跳转");
            }

            @Override
            public void onAnimationEnd(Animator animation) {
                Intent intent = new Intent(WelcomeActivity.this, MainActivity.class);
                startActivity(intent);
            }

            @Override
            public void onAnimationCancel(Animator animation) {

            }

            @Override
            public void onAnimationRepeat(Animator animation) {

            }
        });

    }
}
